package com.kuyou.publiclibrary.utils;

public class WFUtil {
    private Integer value_buf[];

    public WFUtil() {
        value_buf = new Integer[]{0,0,0,0,0,0,0,0};
    }


    public int filter(int a) {
        Integer i = 0;
        Integer value = 0;
        Integer sum = 0;
        value_buf[7] = a; //采集到的数据放入最高位
        for (i = 0; i < 7; i++) {
            value_buf[i] = value_buf[i + 1]; //所有数据左移，低位扔掉
            sum += value_buf[i];
        }
        value = sum / 8;
        return (value);
    }
}
